// 获取主页数据
let oul = document.querySelector("ul");
let oli = document.querySelectorAll("li");

const xhr = new XMLHttpRequest();

xhr.open("get","http://chst.vip:1234/api/getmoneyctrl",true);

xhr.send(null);

xhr.onreadystatechange = function(){
    if(xhr.readyState === 4){
        if(xhr.status === 200){
            let res = JSON.parse(xhr.responseText);
            // console.log(res.result[0]);
            console.log(res);
            let regExp = /(?<=imgurl=)[^'"]*/;
            let ele = "";
            res.result.forEach(item => {
                // console.log(item);
                var img = regExp.exec(item.productImg2)[0];
                ele += ` <li id=${item.productId}>
                            <a href="./pages/xq.html?productid=${item.productId}">
                                <img src="${img}" alt="">
                                <p>
                                    ${item.productName}
                                    <span>${item.productPinkage}</span>
                                </p>
                                <span>${item.productFrom}|${item.productTime}</span>
                                <span>${item.productComCount}</span>
                            </a>
                        </li>`;
            });
            oul.innerHTML = ele;
        }
    }
}












// 更多
$(".container>.col-xs-3")
  .eq(7).click(function () {
    let flag = $(this).prop("flag");
    if (flag) {
      $("#nav>.container").eq(2).slideDown(500);
      $(this).prop("flag", false);
      return;
    }
    $("#nav>.container").eq(2).slideUp(500);
    $(this).prop("flag", true);
  });